
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>
#include <iostream>
#include <string>

using namespace std;
USING_MOCKCPP_NS
USING_TESTNGPP_NS


FIXTURE(Rectangle1,using the pointer to test class Rectangle)			
{

        Rectangle<int> *rectangleIntp;

        SETUP()
        {
             rectangleIntp = new  Rectangle<int>(3,5);
        }
 
        TEARDOWN()
        {
             delete rectangleIntp;
        }
        TEST(should be able to compute the area when changing the rectangle length)
        {
                rectangleIntp->setLength(6);
                ASSERT_EQ(30, rectangleIntp->computeArea());
        }

        TEST(should be able to compute the area when changing the rectangle width)
        {
                rectangleIntp->setWidth(7);
                ASSERT_EQ(21, rectangleIntp->computeArea());
        }

        TEST(should be able to compute the perimeter when changing the rectangle length)
        {
                rectangleIntp->setLength(6);
                ASSERT_EQ(22, rectangleIntp->computePerimeter());
        }

        TEST(should be able to compute the perimeter when changing the rectangle width)
        {
                rectangleIntp->setWidth(8);
                ASSERT_EQ(22, rectangleIntp->computePerimeter());
        }

        TEST(should be able to compute the area when changing the rectangle length and width)
        {
                rectangleIntp->setLength(4);
                rectangleIntp->setWidth(7);
                ASSERT_EQ(28, rectangleIntp->computeArea());
        }

        TEST(should be able to compute the perimeter when changing the rectangle length and width)
        {
                rectangleIntp->setLength(4);
                rectangleIntp->setWidth(7);
                ASSERT_EQ(22, rectangleIntp->computePerimeter());
        }
};


FIXTURE(Rectangle2,using different template parameter to test class Rectangle)			
{

	TEST(should be able to compute the rectangle Area with float parameter)
	{
		Rectangle<float> rectangle(5.0, 6.0);   
 
		ASSERT_EQ(30.0, rectangle.computeArea()); 
	}

        TEST(should be able to compute the rectangle Area with double parameter)
        {
                Rectangle<double> rectangle(1.8, 7.9);
  
                ASSERT_EQ(14.22, rectangle.computeArea());
        }

	TEST(should be able to compute the rectangle Perimeter with float parameter)
	{
		Rectangle<float> rectangle(5.0,6.0);
  
		ASSERT_EQ(22.0, rectangle.computePerimeter());
	}

        TEST(should be able to compute the rectangle Perimeter with double parameter )
        {
                Rectangle<double> rectangle(4.33333333333333, 6);
  
                ASSERT_EQ(20.66666666666666, rectangle.computePerimeter());
        }

};
